package com.buli.blmall.admin.client;

import com.buli.blmall.admin.common.response.Result;
import com.buli.blmall.admin.utils.HttpUtil;
import org.apache.http.client.utils.URIBuilder;

/**
 * @className: PushClient
 * @author: Xiang.Gao
 * @date: 2025/11/19
 * @description:
 */
public class PushClient {

    private static final String PUSH_URL = "https://push.spug.cc/send/bQ2AomqkA7rRK3da";

    /**
     * 发送验证码
     * @param code
     * @param expiration
     * @param phoneNumber
     * @return
     */
    public static Result<?> sendCaptcha(String code, Integer expiration, String phoneNumber) {
        try {
            URIBuilder builder = new URIBuilder(PUSH_URL);
            String url = builder.setParameter("code", code)
                    .setParameter("number", String.valueOf(expiration))
                    .setParameter("targets", phoneNumber)
                    .build().toString();
            return HttpUtil.doGet(url, Result.class);
        } catch (Exception e) {
            throw new RuntimeException("发送短信异常", e);
        }
    }


}
